#include<iostream>
#include<sys/types.h>
#include<sys/shm.h>
#include<sys/ipc.h>
#include<sys/msg.h>
#define PATH "."
#define PROJID 0X66
int main()
{
    key_t key = ftok(PATH,PROJID);//成功返回一个key值失败返回-1;
    if(key < 0)
    {
        perror("ftok error");
        exit(1);
    }
    int shm = shmget(key,4096,IPC_EXCL | IPC_CREAT | 0666);//成功返回一个shm描述符,失败返回-1；
    if(shm < 0)
    {
        perror("shmget error");
        exit(2);
    }
    printf("1\n");
    int msg = msgget(key,IPC_EXCL | IPC_CREAT | 0666);
    if(msg < 0)
    {
        perror("msgget error");
        exit(3);
    }
    printf("2\n");
    return 0;
}